package com.starleague.battletech.unit.jpa.appengine;

import java.util.Map;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.MappedSuperclass;

import com.starleague.battletech.unit.BattletechUnitInternalStructureType;
import com.starleague.battletech.unit.IBattletechUnitInternalStructure;
import com.starleague.battletech.unit.IWeight;

@MappedSuperclass
public abstract class BattletechUnitInternalStructureGae
        extends BattletechUnitComponentGae
        implements IBattletechUnitInternalStructure
{
    @Basic(optional = false)
    @Column(nullable = false)
    @Enumerated(EnumType.STRING)
    BattletechUnitInternalStructureType internalStructureType;

    protected BattletechUnitInternalStructureGae(IWeight weight,
                                              BattletechUnitInternalStructureType internalStructureType)
    {
        super(weight);
        this.internalStructureType = internalStructureType;
    }

    protected BattletechUnitInternalStructureGae()
    {
        //
    }

    @Override
    public BattletechUnitInternalStructureType getInternalStructureType()
    {
        return this.internalStructureType;
    }

    @Override
    public boolean isHittable()
    {
        return false;
    }

    @Override
    public Map<String, Object> infoProperties()
    {
        Map<String, Object> infoPropertyMap = super.infoProperties();
        infoPropertyMap.put("internalStructureType", this.internalStructureType);
        return infoPropertyMap;
    }
}
